package com.cby.springboot.demo.controller;

import com.cby.springboot.demo.bean.Person;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import java.util.Map;

@Controller
public class HelloController extends BaseController {


    @RequestMapping("/hello")
    public String hello(Map<String, Object> map) {
        //通过 map 向前台页面传递数据
        map.put("name", "编程帮（www.biancheng.net）");
        return "hello";
    }

    @Autowired
    private Person person;

    @ResponseBody
    @RequestMapping("/test")
    public Person test() {
        logI("111111");
        return person;
    }

    @RequestMapping("/home")
    public String getHome() {
        return "home";
    }

    @RequestMapping("/home2")
    public ModelAndView getHome2() {
        return new ModelAndView("/home.html");
    }

    @RequestMapping("/thyme")
    public ModelAndView getThymeLeaf() {
        return new ModelAndView("/thymeleaf.html");
    }

}
